package book_management.operation.impl;

import book_management.book.BookList;
import book_management.operation.IOperation;

public class UpdateOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("您现在进行的是书籍的更新操作~");
        System.out.println("请输入需要更新的书籍名称:");
        String booksName = scanner.next();
        if (bookList.isContains(booksName)) {
            // 具体更新操作
            System.out.println("请输入修改后的价格:");
            double price = scanner.nextDouble();
            System.out.println("请输入修改后的书籍类别:");
            String type = scanner.next();
            bookList.bookUpdate(booksName,price,type);
            System.out.println("书籍详情修改成功~");
        }else {
            System.err.println("书籍不存在");
        }
    }
}
